Skip to content

Label rows of directed models as outgoing, columns as incoming - #74

Draft
alexpghayes wants to merge 1 commit into
mainfrom
fix/directed-in-out-labels
Draft

alexpghayes wants to merge 1 commit into
mainfrom
fix/directed-in-out-labels

Conversation

@alexpghayes

Copy link
Copy Markdown
Collaborator

Bug

The convention in the code is rows of A = senders = outgoing = X / z_out / theta_out, and expected_out_degree() is edges / n. Several labels had it backwards:

  • print.directed_factor_model() called n / k1 "Incoming Nodes" / "Incoming Rank" and d / k2 "Outgoing".
  • The directed_factor_model() @param X / @param Y and @return docs had the same swap.
  • The validate_directed_dcsbm() messages called z_out / pi_out the "incoming rank" (and one said z1).
  • The directed_dcsbm() details described x as the incoming block but drew it from pi_out, and called θ_out the propensity for incoming edges. The force_identifiability doc said theta_out was normalized within incoming blocks; the code normalizes within outgoing blocks.

Fix

Every label now follows the convention above. The "Edge formulation" details also state the rate explicitly, lambda[i, j] = theta_out[i] * B[x[i], y[j]] * theta_in[j], and fix a couple of typos. There are no code changes beyond strings.

Tests

Added to tests/testthat/test-directedness.R: the print labels of a 3 × 5 model, out/in degree as edges per row/column, and the validator messages for pi_out / pi_in. Fails on main (4 failures, 1 error), passes here. Full suite passes. Docs regenerated with roxygen2 7.3.2 (directed_erdos_renyi.Rd inherits the directed_factor_model() docs).

NEWS

Left out to avoid conflicting with #59. Suggested bullet under Documentation:

  • Fixed incoming and outgoing being swapped in print() for directed factor models, in the directed_factor_model() and directed_dcsbm() documentation, and in directed_dcsbm() error messages. Rows of A (X, z_out, theta_out) are senders, i.e. outgoing.

🤖 Generated with Claude Code

Rows of A are senders: X, z_out and theta_out describe outgoing edges,
and expected_out_degree() is edges / n. print.directed_factor_model(),
the directed_factor_model() docs, the validate_directed_dcsbm() error
messages and the directed_dcsbm() details had incoming and outgoing
swapped in places. Make every label match the code, and write out the
edge rate lambda[i, j] = theta_out[i] B[x[i], y[j]] theta_in[j].

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant